package impl

import (
	"api-gateway-core/socket/parser"
	"net/http"
)

type GetRequestParser struct {
}

func (this *GetRequestParser) Parse(request *http.Request) parser.ReqParserRes {
	params := make(map[string]any)
	err := request.ParseForm()
	if err != nil {
		return parser.ReqParserRes{
			InfoMap: nil,
			Err:     err,
		}
	}
	for k, v := range request.Form {
		params[k] = v[0]
	}
	return parser.ReqParserRes{
		InfoMap: params,
		Err:     nil,
	}
}
